package com.example.travel.service;


import com.example.travel.mapper.SellerMapper;
import com.example.travel.pojo.Seller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SellerService {

    @Autowired
    private SellerMapper sellerMapper;

    //多条件分页查询
    public PageInfo<Seller> PageInfoFindByParam(Integer pageNum,
                                                Integer pageSize,
                                                Seller seller){


        return PageHelper.startPage(pageNum,pageSize).doSelectPageInfo(()->{
            sellerMapper.findByParam(seller);
        });
    }

    //新增旅游公司
    public int addSeller(Seller seller){

        return sellerMapper.insert(seller);
    }

    //获取原数据信息
    public Seller getInfo(Integer sId){

        return sellerMapper.selectById(sId);
    }

    //更新
    public int update(Seller seller){

        return sellerMapper.updateById(seller);
    }

    //删除
    public int deleteSeller(Integer sid){

        return sellerMapper.deleteById(sid);
    }

}
